using System.ComponentModel.DataAnnotations;

namespace StudentManagement.Application.DTOs;

public class UserDTO
{
    public int Id { get; set; }
    
    [Required(ErrorMessage = "用户名不能为空")]
    [StringLength(50, ErrorMessage = "用户名长度不能超过50个字符")]
    public string Username { get; set; }
    
    [Required(ErrorMessage = "电子邮箱不能为空")]
    [EmailAddress(ErrorMessage = "请输入有效的电子邮箱地址")]
    public string Email { get; set; }
    
    [StringLength(20, ErrorMessage = "电话号码长度不能超过20个字符")]
    public string PhoneNumber { get; set; }
    
    [Required(ErrorMessage = "全名不能为空")]
    [StringLength(100, ErrorMessage = "全名长度不能超过100个字符")]
    public string FullName { get; set; }
    
    // 仅用于注册和更新操作，不会返回给前端
    [Required(ErrorMessage = "密码不能为空")]
    [StringLength(100, MinimumLength = 8, ErrorMessage = "密码长度不能少于8个字符")]
    public string Password { get; set; }
    
    public bool IsActive { get; set; }
    
    public DateTime CreatedAt { get; set; }
    
    public DateTime? LastLoginAt { get; set; }
    
    // 角色信息
    public List<string> Roles { get; set; } = new List<string>();
}